<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/admin.css";?>" />
<script charset="UTF-8" src="/runtime/systemjs/jquery-1.4.4.min.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/artdialog/artDialog.min.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/form.js"></script>
<link rel="stylesheet" type="text/css" href="/runtime/systemjs/autovalidate/style.css"/><script charset="UTF-8" src="/runtime/systemjs/autovalidate/validate.js"></script>
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/common.js";?>"></script>
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/admin.js";?>"></script>
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/menu.js";?>"></script>
</head>
<body>
<div class="container">
	<div id="header">
		<div id="menu">
			<ul name="menu">
			</ul>
		</div>
		<p><a href="<?php echo IUrl::creatUrl("/systemadmin/logout");?>">退出管理</a> <a href="<?php echo IUrl::creatUrl("/system/default");?>">后台首页</a> <a href="<?php echo IUrl::creatUrl("");?>" target='_blank'>商城首页</a> <span>您好 <label class='bold'><?php echo isset($this->admin['admin_name'])?$this->admin['admin_name']:"";?></label>，当前身份 <label class='bold'><?php echo isset($this->admin['admin_role_name'])?$this->admin['admin_role_name']:"";?></label></span></p>
	</div>
	<?php $admin_id = $this->admin['admin_id']?>
	<div id="info_bar"><label class="navindex"><a href="<?php echo IUrl::creatUrl("/system/navigation");?>">快速导航管理</a></label><span class="nav_sec">
	<?php $query = new IQuery("quick_naviga");$query->where = "adminid = $admin_id and is_del = 0";$items = $query->find(); foreach($items as $key => $item){?>
	<a href="<?php echo isset($item['url'])?$item['url']:"";?>" class="selected"><?php echo isset($item['naviga_name'])?$item['naviga_name']:"";?></a>
	<?php }?>
	</span></div>
	<div id="admin_left">
		<ul class="submenu">
		</ul>
		<div id="copyright">
			
		</div>
	</div>
	<?php $menu = new Menu();?>
	<script type='text/javascript'>
		var data = <?php echo $menu->submenu();?>;
		var current = '<?php echo $menu->current;?>';
		var url='<?php echo IUrl::creatUrl("/");?>';
		initMenu(data,current,url);
	</script>
	<div id="admin_right">
	<?php $ship=$this->data?>
<div class="headbar clearfix">
	<div class="position">订单<span>></span><span>快递单管理</span><span>></span><span><?php if(isset($ship['id'])){?>修改<?php }else{?>添加<?php }?>发货信息</span></div>
</div>
<form name="ModelForm" action="<?php echo IUrl::creatUrl("/order/ship_info_update");?>" method="post"  onsubmit="return checkForm();">
<div class="content_box">
	<div class="content form_content">
		<table id="tab-1" class="form_table" name="table">
			<col width="150px" />
			<col />
			<tr>
				<th>发货点名称：</th><input type="hidden" name="sid" value="<?php echo isset($ship['id'])?$ship['id']:"";?>"/>
				<td><input class="normal" name="ship_name" type="text" pattern="required" value="<?php echo isset($ship['ship_name'])?$ship['ship_name']:"";?>" alt="发货点名称"//><label>*发货地点名称</label></td>
			</tr>
			<tr>
				<th>发货人姓名：</th>
				<td><input class="normal" name="ship_user_name" type="text" pattern="required" value="<?php echo isset($ship['ship_user_name'])?$ship['ship_user_name']:"";?>"  alt="发货人姓名"/><label>*发货人名称</label></td>
			</tr>
			<tr>
				<th>性别：</th>
				<td><label class='attr'><input type="radio" name="sex" value="1" checked/>先生</label><label class='attr'><input type="radio" name="sex" value="0" <?php if($ship['sex']==0){?>checked='checked'<?php }?>/>女士</label><label>*</label></td>
			</tr>
			<tr>
				<th>地区：</th>
				<td>
				<select name="province" id="province" onchange="select_city(this.value,2);">
				<?php $query = new IQuery("areas");$query->where = "parent_id = 0";$items = $query->find(); foreach($items as $key => $item){?><option value="<?php echo isset($item['area_id'])?$item['area_id']:"";?>" <?php if(($ship['province']!='') && ($ship['province']==$item['area_id'])){?>selected<?php }?>><?php echo isset($item['area_name'])?$item['area_name']:"";?></option><?php }?>
				</select>
				<span id="selec2"></span><span id="selec3"></span><span>*</span>
				</td>
			</tr>
			<tr>
				<th>地址：</th>
				<td><input class="normal" name="address" type="text" pattern="required" value="<?php echo isset($ship['address'])?$ship['address']:"";?>"  alt="具体地址错误"/><label>*具体地址</label></td>
			</tr>
			<tr>
				<th>邮编：</th>
				<td><input class="normal" name="postcode" type="text" pattern="zip" value="<?php echo isset($ship['postcode'])?$ship['postcode']:"";?>"  alt="邮编错误"/><label>*邮政编码</label></td>
			</tr>
			<tr>
				<th>手机：</th>
				<td><input class="normal" name="mobile" type="text" pattern='mobi' value="<?php echo isset($ship['mobile'])?$ship['mobile']:"";?>"/><label>*手机号码</label></td>
			</tr>
			<tr>
				<th>电话：</th>
				<td><input class="normal" name="telphone" type="text" pattern="phone" empty alt="电话号码错误" value="<?php echo isset($ship['telphone'])?$ship['telphone']:"";?>" /></td>
			</tr>
			<tr>
				<th></th>
				<td><label><input type="checkbox" name="is_default" value="1" <?php if($ship['is_default']==1){?>checked='checked'<?php }?>/>&nbsp;设置为默认地址</label></td>
			</tr>
		</table>
		<table class="form_table">
			<col width="150px" />
			<col />
			<tr>
				<td></td>
				<td><button class="submit" type="button" onclick = "checkForm()"><span>保 存</span></button></td>
			</tr>
		</table>
	</div>
</div>
</form>
<script>
var province_va = '';
var city_va = '';
var area_va = '';
<?php if($ship['province']!=''){?>
province_va = <?php echo isset($ship['province'])?$ship['province']:"";?>;
city_va = <?php echo isset($ship['city'])?$ship['city']:"";?>;
area_va = <?php echo isset($ship['area'])?$ship['area']:"";?>;
<?php }?>
if(city_va!='')
{
	select_city(province_va,2)
}
if(area_va!='')
{
	select_city(city_va,3)
}
function select_city(city,style)
{
	$.getJSON("<?php echo IUrl::creatUrl("/block/area_child");?>",{aid:city}, function(json)
	{
		if(style==2)
		{
			var select_html = '<select name="city" id="city" onchange="select_city(this.value,3);">';
			select_html += '<option value="">请选择城市</option>';
			for( a in json)
			{
				if(json[a]['area_id']==city_va)
				{
					select_html +='<option value="'+json[a]['area_id']+'" selected>'+json[a]['area_name']+'</option>';
				}
				else
				{
					select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
				}
			}
			select_html +='</select>';
			if($("#selec3").text()=='')$("#selec3").hide();
			$("#selec"+style).html(select_html);
		}else
		{
			var select_html = '<select name="area" id="area">';
			select_html += '<option value="">请选择地区</option>';
			for( a in json)
			{
				if(json[a]['area_id']==area_va)
				{
					select_html +='<option value="'+json[a]['area_id']+'" selected>'+json[a]['area_name']+'</option>';
				}
				else
				{
					select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
				}
			}
			select_html +='</select>';
			$("#selec"+style).show();
			$("#selec"+style).html(select_html);
		}
	});
}
function checkForm()
{
	var city = $("#city").val();
	var area = $("#area").val();
	var isPass = true;
	if(city==undefined || city=='')
	{
		alert("请选择城市！");
		isPass = false;
		return false;
	}
	if(area==undefined || area=='')
	{
		alert('请选择地区');
		isPass = false;
		return false;
	}
	if(document.ModelForm.onsubmit()!=false && isPass)
		document.ModelForm.submit();
}

</script>

	</div>
	<div id="separator"></div>
</div>
<script type='text/javascript'>
	//隔行换色
	$(".list_table tr::nth-child(even)").addClass('even');
	$(".list_table tr").hover(
		function () {
			$(this).addClass("sel");
		},
		function () {
			$(this).removeClass("sel");
		}
	);
	$(function(){
		 $('#headth th').each(function(i){
			var width = $('#headth th:eq('+i+')').width();
			$('#conth tr:eq(0) td:eq('+i+')').width(width-2);
		});
	});
</script>
</body>
</html>
